package edu.pitt.dbmi.odie.gapp.gwt.client.progress;

import com.smartgwt.client.widgets.layout.HStack;

public class ODIE_ProgressBar extends HStack {
	private final HStack progressHStack = new HStack();
	private int width;

	public ODIE_ProgressBar(final int width, final int height, final String color) {
		super();
		this.setWidth(width);
		this.width = width - 2;
		this.setHeight(height);
		progressHStack.setBackgroundColor(color);
		progressHStack.setWidth(1); // Not sure why this needs this to be greater than 0
		this.addMember(progressHStack);
	}

	public void setPercentDone(int percent) {
		percent = Math.min(100, percent);
		final int progressWidth =  (width * percent)/100 ;
		progressHStack.setWidth(progressWidth);
	}

	public void setProgressColor(final String color) {
		progressHStack.setBackgroundColor(color);
	}
}